package com.test;

import com.pojo.User;
import com.sun.tools.hat.internal.model.StackTrace;
import com.yum.Annotation.YSet;
import com.yum.Iterator.List.Vector.Stack.YStack;
import com.yum.Iterator.List.YArrayList.YArrayList;
import com.yum.Iterator.List.YArrayList.YLinkedList.YLinkedList;
import com.yum.Iterator.List.YList;
import com.yum.lang.YInteger;
import com.yum.lang.YString;
import com.yum.yumThrows.ArrayList.ALException;

import java.util.*;

public class test {

    static YLinkedList<String> linkedList = new YLinkedList<>();

    public static void main(String[] args) throws ALException {

        BTToLinkList();
//        stackTest();

//        YList<Integer> yList = new YArrayList<Integer>();
//
//        for(int i=0;i<100;i++){
//            yList.add(i);
//        }
//
//        for(int i:yList){
//            System.out.println(i);
//        }


//        YLinkedList<String> yLinkedList = new YLinkedList<>();
//        yLinkedList.add("小米");
//        yLinkedList.add("小名");
//        yLinkedList.add("小哦");
//        yLinkedList.add("小里");
//        yLinkedList.add("小鸿");
//
//        yLinkedList.remove("小米");
//
//        System.out.println(yLinkedList.getValue(3));
//
//        System.out.println(yLinkedList.toString());


//        yList.add("你好");
//        yList.add("小明");
//        yList.add("小红");
//        yList.add("hooll");
//        yList.add("ppo");
//
//        System.out.println(yList.getValue(4));
//        System.out.println(yList.getValue(2));
//
//
//        yList.removeAll();
//
//        System.out.println(yList.getValue(1));
//
//
//
//
//
//
////        for (int i=0;i<100;i++){
////            System.out.println(yList.getValue(i));
////        }
//
//        System.out.println(yList.indexOf("95"));
//
//
//        yList.removeAll();
//
//        System.out.println(yList.size());


    }


    private static void BTToLinkList(){

        BTree<String> bTree = new BTree<String>("A",null);
        BTree<String> bTreeTwo = new BTree<>("B",bTree);
        BTree<String> bTreeThr = new BTree<>("C",bTreeTwo);
        BTree<String> bTreeFour = new BTree<>("E",bTree);
        BTree<String> bTreeFi = new BTree<>("F",bTreeFour);
        BTree<String> bTreeSix = new BTree<>("G",bTreeFour);
        bTree.setLeft(bTreeTwo);
        bTreeTwo.setLeft(bTreeThr);

        bTree.setRight(bTreeFour);
        bTreeFour.setLeft(bTreeFi);
        bTreeFour.setRight(bTreeSix);


        TreeToList(bTree);
        System.out.println(linkedList.toString());

    }

    private static void TreeToList(BTree<String> value){
        if(value == null)
            return;
        AddList(value);
        TreeToList(value.getLeft());
        TreeToList(value.getRight());
    }

    private static void AddList(BTree<String> value){
        linkedList.add(value.data);
    }







    private static void stackTest(){
        YStack<String> yStack = new YStack<>();

        yStack.push("您好");
        yStack.push("再见");
        yStack.push("我是");
        yStack.push("小米");
        yStack.push("拜拜");



        System.out.println(yStack.toString());
    }

}
